package entity

import "github.com/lib/pq"

type User struct {
	ID int64 `gorm:"column:id;type:BIGINT;primary_key" json:"id"`

	Phone string `gorm:"column:phone;type:VARCHAR(32)" json:"phone"`

	Name string `gorm:"column:name;type:VARCHAR(32)" json:"name"`

	WxID string `gorm:"column:wx_id;type:VARCHAR(128)" json:"wx_id"`

	AppleID string `gorm:"column:apple_id;type:VARCHAR(128)" json:"apple_id"`

	Password string `gorm:"column:password;type:VARCHAR(255)" json:"password"`

	Salt string `gorm:"column:salt;type:VARCHAR(32)" json:"salt"`

	Status int `gorm:"column:status;type:TINYINT" json:"status"`

	Picture string `gorm:"column:picture;type:VARCHAR(512)" json:"picture"`

	Type string `gorm:"column:type;type:VARCHAR(32)" json:"type"`

	RoleIds pq.Int64Array `gorm:"column:role_ids;type:BIGINT"  json:"role_ids"`

	CreatedAt int64 `gorm:"column:created_at;type:BIGINT" json:"created_at"`

	UpdatedAt int64 `gorm:"column:updated_at;type:BIGINT" json:"updated_at"`
	DeptId    int64 `gorm:"column:dept_id;type:BIGINT" json:"dept_id"`
}

func (a *User) TableName() string {
	return "users"
}
